#coding:utf-8
from django.db import models
from django.contrib.auth.models import User
from wall.models import WallList

# Create your models here.
class Tag(models.Model):
    name = models.CharField(max_length = 50)

class BookWall(models.Model):
    name = models.CharField(max_length = 100)
    second = models.CharField(null = True,max_length = 100)
    isbn = models.CharField(max_length = 50)
    doubanlink = models.URLField(null = True)
    imglink_chuxin = models.CharField(null = True,max_length = 100)
    imglink_douban = models.URLField(null = True)
    content = models.TextField(null = True)
    publisher = models.CharField(null = True,max_length = 100)
    publish_time = models.CharField(max_length = 10)
    price = models.CharField(max_length = 10,default = "不详")
    author1 = models.CharField(null = True,max_length = 50)
    author2 = models.CharField(max_length = 50, default = "null")
    user = models.ForeignKey(User)
    create_time = models.DateTimeField(auto_now = True, auto_now_add = False)

class BookExchangeList(models.Model):
    wall = models.ForeignKey(WallList)
    book = models.ForeignKey(BookWall)

class BookTag(models.Model):
    tag = models.ForeignKey(Tag)
    book = models.ForeignKey(BookWall)
